package src.leetcode.dp.medium_0300;

public class lengthOfLIS {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.lengthOfLIS(new int[]{10, 9, 2, 5, 3, 7, 101, 18}));
    }
}


class Solution {
    public int lengthOfLIS(int[] nums) {
        int []dp = new int[nums.length];
        dp[0] = 1;

        for(int i = 1; i < nums.length; i++) {
            for (int j = 0; j < i; j++) {
                if(nums[i] > nums[j]) dp[i] = Math.max(dp[i], dp[j] + 1);
            }
        }

        return dp[nums.length - 1];
    }
}